package com.yunhai.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.model.entity.sys.Feedback;
import com.yunhai.model.vo.sys.SysUserFeedbackVo;
import com.yunhai.system.service.FeedbackService;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/systems")
public class FeedbackController {

    @Resource
    private FeedbackService feedbackService;

    @GetMapping("/feedback/pagination")
    public Ret getFeedbackPagination(PaginationVo paginationVo) throws Exception {

        IPage page = feedbackService.getFeedbackPagination(paginationVo);
        return Ret.toPage(page);
    }

    @PostMapping("/feedback")
    public Ret addFeedBack( @RequestBody SysUserFeedbackVo sysUserFeedbackVo) throws Exception {
        feedbackService.addFeedBack(sysUserFeedbackVo);
        return Ret.ok();
    }

    /**
     * 删除用户反馈
     * */
    @PostMapping("/feedback/batchRemove")
    public Ret batchRemoveUserFeedback( @RequestBody List<Long> ids ) throws Exception {

        feedbackService.batchRemoveUserFeedback(ids);
        return Ret.ok();
    }

}
